package Haak::C::Idea;

use strict;
use warnings;
use base qw( Haak );
use DateTime;

sub do_default {
    my $self = shift;

    my $items = $self->M('MyDB::Idea')->search();

    $self->stash->{items} = $items;
}

sub do_add {
    my $self = shift;

    my $param = $self->req->parameters;

    my $dt = DateTime->now( time_zone => 'Asia/Seoul' );

    my $data;
    eval {
	$data = $self->M('MyDB::Idea')->create({
	    nick => $param->{nick},
	    subject => $param->{subject},
	    create_at => $dt->ymd." ".$dt->hms,
				       });
    };

    $self->res->status('200');
    $self->res->body($data->no);

}
1;

=head1 NAME

Haak::C::Idea - Soozy Component

=head1 SYNOPSIS

See L<Haak>

=head1 DESCRIPTION

Soozy Component

=head1 AUTHOR

root

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut
